﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using MVCEF.Models;

namespace MVCEF.DBContext
{
    [DbConfigurationType(typeof(CustomDbConfiguration))]
    public class EfDbContext : DbContext
    {
        public EfDbContext():base("EFDbContext")
        {
            Database.SetInitializer(new DropCreateDatabaseIfModelChanges<EfDbContext>());
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            //modelBuilder.Entity<Order>().ToTable("Orders");
            modelBuilder.ComplexType<Address>();

            base.OnModelCreating(modelBuilder);
        }


        public DbSet<Blog> Blog { get; set; }

        public DbSet<Order> Order { get; set; }
    }
}

